<template>
    <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose title="排产日志" :width="1024">
        <JVxeTable keep-source resizable ref="productionSchedulingLog" :loading="productionSchedulingLogTable.loading"
            :columns="productionSchedulingLogTable.columns" :dataSource="productionSchedulingLogTable.dataSource"
            :pagination="pagination2" :toolbar="true" @pageChange="pageChange">
            <template #toolbarSuffix>
          <a-form
              layout="inline"
              @finish="getList"
              :labelCol="{ span: 8 }"
              style="margin-bottom: 10px"
            >             
              <a-form-item>
                <a-button type="primary" html-type="finish">刷新</a-button>
              </a-form-item>
            </a-form>
          </template>
            <template #statusSlot="props">
                {{ props.row.status === 0 ? '运行中' : props.row.status === 1 ? '成功' : '失败' }}
            </template>
        </JVxeTable>
    </BasicModal>
</template>
  
<script lang="ts" setup>
import { reactive,onMounted } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
import { productionSchedulingLogColumns } from '../PsPlanningScheduling.data';
import {
    gerProductionSchedulingLogList,
} from '../PsPlanningScheduling.api';

const [registerModal, { setModalProps }] = useModalInner(async (data) => {

    setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });

});

const productionSchedulingLogTable = reactive({
    loading: false,
    dataSource: <Array<any>>[],
    columns: productionSchedulingLogColumns,
});
function getList() {
    pagination2.current = 1;
    getSchedulingListTwo();
}
const pagination2 = reactive({
    current: 1,
    pageSize: 10,
    total: 0,
});
async function getSchedulingListTwo() {
    // 处理分页参数
    let tempParams = {
        column: "createTime",
        order: "desc",
        pageNo: pagination2.current,
        pageSize: pagination2.pageSize,
    };
    let res = await gerProductionSchedulingLogList(tempParams);
    productionSchedulingLogTable.dataSource = res.records;
    pagination2.total = res.total;
}
function pageChange({ current, pageSize }) {
    pagination2.current = current;
    pagination2.pageSize = pageSize;
    getSchedulingListTwo();
}
onMounted(()=> {
    getList()
})
</script>
  
<style lang="less" scoped>  /** 时间和数字输入框样式 */
  :deep(.ant-input-number) {
      width: 100%;
  }

  :deep(.ant-calendar-picker) {
      width: 100%;
  }
</style>
  